// import com.alibaba.druid.sql.ast.SQLExpr_ptr;
// import com.alibaba.druid.sql.ast.expr.SQLCharExpr_ptr;
// import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr_ptr;
// import com.alibaba.druid.sql.ast.statement.SQLAlterStatement;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "MySqlAlterUserStatement.h"
#include "../../../../ast/SQLExpr.h"
#include "../../../../ast/expr/SQLCharExpr.h"
#include "../../../../ast/expr/SQLIntegerExpr.h"
#include "../../visitor/MySqlASTVisitor.h"

SQLCharExpr_ptr MySqlAlterUserStatement_AuthOption::getAuthString()
{
  return authString;
}

void MySqlAlterUserStatement_AuthOption::setAuthString(SQLCharExpr_ptr authString)
{
  this->authString = authString;
}

SQLExpr_ptr MySqlAlterUserStatement_AlterUser::getUser()
{
  return user;
}

void MySqlAlterUserStatement_AlterUser::setUser(SQLExpr_ptr user)
{
  this->user = user;
}

MySqlAlterUserStatement_AuthOption_ptr MySqlAlterUserStatement_AlterUser::getAuthOption()
{
  return authOption;
}

void MySqlAlterUserStatement_AlterUser::setAuthOption(MySqlAlterUserStatement_AuthOption_ptr authOption)
{
  this->authOption = authOption;
}

MySqlAlterUserStatement_PasswordExpire_ptr MySqlAlterUserStatement_PasswordOption::getExpire()
{
  return expire;
}

void MySqlAlterUserStatement_PasswordOption::setExpire(MySqlAlterUserStatement_PasswordExpire_ptr expire)
{
  this->expire = expire;
}

SQLIntegerExpr_ptr MySqlAlterUserStatement_PasswordOption::getIntervalDays()
{
  return intervalDays;
}

void MySqlAlterUserStatement_PasswordOption::setIntervalDays(SQLIntegerExpr_ptr intervalDays)
{
  this->intervalDays = intervalDays;
}

MySqlAlterUserStatement_PasswordExpire_ptr MySqlAlterUserStatement_PasswordExpire::PASSWORD_EXPIRE = MySqlAlterUserStatement_PasswordExpire_ptr(new MySqlAlterUserStatement_PasswordExpire(1 << 0, make_string_ptr("PASSWORD_EXPIRE")));
MySqlAlterUserStatement_PasswordExpire_ptr MySqlAlterUserStatement_PasswordExpire::PASSWORD_EXPIRE_DEFAULT = MySqlAlterUserStatement_PasswordExpire_ptr(new MySqlAlterUserStatement_PasswordExpire(1 << 1, make_string_ptr("PASSWORD_EXPIRE_DEFAULT")));
MySqlAlterUserStatement_PasswordExpire_ptr MySqlAlterUserStatement_PasswordExpire::PASSWORD_EXPIRE_NEVER = MySqlAlterUserStatement_PasswordExpire_ptr(new MySqlAlterUserStatement_PasswordExpire(1 << 2, make_string_ptr("PASSWORD_EXPIRE_NEVER")));
MySqlAlterUserStatement_PasswordExpire_ptr MySqlAlterUserStatement_PasswordExpire::PASSWORD_EXPIRE_INTERVAL = MySqlAlterUserStatement_PasswordExpire_ptr(new MySqlAlterUserStatement_PasswordExpire(1 << 3, make_string_ptr("PASSWORD_EXPIRE_INTERVAL")));

MySqlAlterUserStatement_PasswordExpire::MySqlAlterUserStatement_PasswordExpire(uint64_t mask, string_ptr name)
{
  this->mask = mask;
  this->name = name;
}

MySqlAlterUserStatement::MySqlAlterUserStatement()
{
  alterUsers = std::make_shared<std::list<MySqlAlterUserStatement_AlterUser_ptr>>();
}
void MySqlAlterUserStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlAlterUserStatement)))
  {
    for (MySqlAlterUserStatement_AlterUser_ptr alterUser : *alterUsers)
    {
      acceptChild(visitor, alterUser->user);
    }
    if (passwordOption != nullptr && passwordOption->getIntervalDays() != nullptr)
    {
      acceptChild(visitor, passwordOption->getIntervalDays());
    }
  }
  visitor->endVisit(SharedObject(MySqlAlterUserStatement));
}

BOOL_ptr MySqlAlterUserStatement::isIfExists()
{
  return ifExists;
}

void MySqlAlterUserStatement::setIfExists(BOOL_ptr ifExists)
{
  this->ifExists = ifExists;
}

SQLExpr_list_ptr MySqlAlterUserStatement::getUsers()
{
  SQLExpr_list_ptr users = std::make_shared<std::list<SQLExpr_ptr>>();

  for (MySqlAlterUserStatement_AlterUser_ptr alterUser : *alterUsers)
  {
    users->push_back(alterUser->user);
  }
  return users;
}

MySqlAlterUserStatement_AlterUser_list_ptr MySqlAlterUserStatement::getAlterUsers()
{
  return alterUsers;
}

MySqlAlterUserStatement_PasswordOption_ptr MySqlAlterUserStatement::getPasswordOption()
{
  return passwordOption;
}

void MySqlAlterUserStatement::setPasswordOption(MySqlAlterUserStatement_PasswordOption_ptr passwordOption)
{
  this->passwordOption = passwordOption;
}
